package com.oocl.crm.util;

public class CommandParser {

	public static String[] parseCustomerInfo(String command) {
		/* 
		 * index 0 -> id
		 * index 1 -> name
		 * index 2 -> sex
		 * index 3 -> birthday
		 * index 4 -> address
		 * index 5 -> phone
		 */
		String[] info = new String[7];
		for (String singleInfo : command.split(",")) {
			String[] pair = singleInfo.split(":");
			switch (pair[0]) {
			case "id":
				info[0] = pair[1];
				break;
			case "name":
				info[1] = pair[1];
				break;
			case "sex":
				info[2] = pair[1];
				break;
			case "birthday":
				info[3] = pair[1];
				break;
			case "address":
				info[4] = pair[1];
				break;
			case "phone":
				info[5] = pair[1];
				break;
			}
		}
		return info;
	}
}
